home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / AIncludes / IntEnv.a < prev    next >
Encoding:
Text File  |  1992-01-29  |  4.4 KB  |  119 lines  |  [TEXT/MPS ]

  1. ;  File IntEnv.a
  2. ;
  3. ;  Copyright Apple Computer, Inc. 1986 - 1991
  4. ;  All rights reserved.
  5. ;
  6. ;  Include File for Accessing the Integrated Environment Libraries
  7.  
  8. ;  Set CASE OBJECT to assure references to the names IMPORTed here link
  9. ;  properly.  The following statements restore the CASE setting to its
  10. ;  previous value.
  11.  
  12.     IF &TYPE('__INCLUDINGINTENV__') = 'UNDEFINED' THEN
  13. __INCLUDINGINTENV__    SET    1
  14.  
  15.             PRINT            Push,Off            ; save current print settings and turn it off
  16.             GBLC            &S%%%,&P%%%
  17. &S%%%        SETC            &Setting('CASE')    ; save current CASE setting
  18. &P%%%        SETC            &Setting('PRINT',1) ; and PRINT settings before we changed them
  19.  
  20.             MACRO
  21.             X%%%
  22.             GBLC            &S%%%,&P%%%         ; link references with previously defined variables
  23.             PRINT            Push,&P%%%            ; restore the previous PRINT settings
  24.             CASE            &S%%%                ; and restore the CASE setting
  25.             PRINT            POP                 ; restore the PRINT settings
  26.             ENDM
  27.  
  28.             PRINT            Pop                 ; restore the PRINT settings
  29.             CASE            OBJECT                ; all imported/exported names case significant
  30.  
  31. ;  Integrated Environment Globals
  32.  
  33.             IMPORT            StandAlone            ; a long, 0 if in shell, 1 if standalone
  34.             IMPORT            errno                ; a long, error number; set on unsuccessful I/O calls
  35.             IMPORT            MacOSErr            ; a word;  set along with errno if appropriate
  36.  
  37. ;  Integrated Environment Routines
  38.  
  39.             IMPORT            _DataInit            ; called for you by _RTInit
  40.             IMPORT            _RTInit             ; your tool MUST call this routine on startup
  41.             IMPORT            _RTExit             ; Does NOT return
  42.             IMPORT            getenv
  43.             IMPORT            IEGETENV
  44.             IMPORT            atexit
  45.             IMPORT            exit
  46.             IMPORT            _exit
  47.             IMPORT            faccess
  48. ;  cmd values for faccess
  49. ;  F_OPEN        EQU         (('d'<<8)|$0)        ; for internal use only
  50. ; 'd' => "directory" ops; available for any program
  51. F_DELETE        EQU         (('d'<<8)|$1)        ; deletes filename
  52. F_RENAME        EQU         (('d'<<8)|$2)        ; renames file to string pointed to by arg
  53. ;  'e' => "editor" ops; available to programs running under MPW
  54. F_GTABINFO        EQU         (('e'<<8)|$0)        ; arg is address of long, has tab offset
  55. F_STABINFO        EQU         (('e'<<8)|$1)        ; arg is address of long, new tab offset
  56. F_GFONTINFO     EQU         (('e'<<8)|$2)        ; arg is address of long, has font info
  57. F_SFONTINFO     EQU         (('e'<<8)|$3)        ; arg is address of long, new font info
  58.                                                 ; high order-font number; low-font size
  59. F_GPRINTREC     EQU         (('e'<<8)|$4)        ; arg is handle to print record TPrint
  60. F_SPRINTREC     EQU         (('e'<<8)|$5)        ; arg sets handle to print record TPrint
  61. F_GSELINFO        EQU            (('e'<<8)|$6)        ; arg is address of selection record
  62. F_SSELINFO        EQU            (('e'<<8)|$7)        ; arg is address of selection record
  63. F_GWININFO        EQU            (('e'<<8)|$8)        ; arg is address of a rect
  64. F_SWININFO        EQU            (('e'<<8)|$9)        ; arg is address of a rect
  65. F_GSCROLLINFO    EQU            (('e'<<8)|$A)        ; get scroll information
  66. F_SSCROLLINFO    EQU            (('e'<<8)|$B)        ; set scroll information
  67.  
  68.             IMPORT            open
  69. ;  mode values for open call
  70. O_RDONLY        EQU         0
  71. O_WRONLY        EQU         1
  72. O_RDWR            EQU         2
  73.  
  74. ; auxiliary mode flags for open call  (one of above plus zero or more from this list)
  75. O_APPEND        EQU         (1<<3)            ; when writing, seek to EOF before each write
  76. O_RSRC            EQU         (1<<4)            ; open the resource fork
  77. O_CREAT         EQU         (1<<8)            ; create file if it doesn't exist
  78. O_TRUNC         EQU         (1<<9)            ; truncate file to zero size
  79.  
  80. ; only valid with O_CREAT specified
  81. O_EXCL            EQU         (1<<10)         ; if O_CREAT is set, open will fail if file exists
  82.  
  83. ;  predefined file descriptors for standard input, standard output, and diagnostic output
  84. InputFD         EQU         0
  85. OutputFD        EQU         1
  86. DiagnosticFD    EQU         2
  87.  
  88.             IMPORT            close
  89.             IMPORT            read
  90.             IMPORT            write
  91.             IMPORT            ioctl
  92.  
  93. ;  selector values for ioctl calls
  94. ;  FIOLSEEK     EQU         (('f'<<8)|00)    ; internal use only
  95. ;  FIODUPFD     EQU         (('f'<<8)|01)    ; internal use only
  96. FIOINTERACTIVE    EQU         (('f'<<8)|02)    ; returns 0 if interactive, -1 if not
  97. FIOBUFSIZE        EQU         (('f'<<8)|03)    ; Arg is address of long, returns the optimal
  98.                                             ; buffer size for this device
  99. FIOFNAME        EQU         (('f'<<8)|04)    ; Arg is address of filename associated with  fd
  100. FIOREFNUM        EQU         (('f'<<8)|05)    ; Arg is address of short, returns fd's refnum
  101. FIOSETEOF        EQU         (('f'<<8)|06)    ; Set file length to long in arg
  102. TIOFLUSH        EQU         (('t'<<8)|00)    ; throw away terminal input
  103.  
  104.             IMPORT            lseek
  105. ;  mode values for lseek
  106. fromStart        EQU         0
  107. fromCurPos        EQU         1
  108. fromEnd         EQU         2
  109.  
  110.             IMPORT            fcntl
  111. ;  argument to fcntl
  112. F_DUPFD         EQU         0
  113.  
  114.  
  115.             PRINT            Push,Off        ; save and turn off PRINT when macro is invoked
  116.             X%%%                            ; invoke the macro to restore CASE setting
  117.             PRINT            POP             ; restore the PRINT settings
  118.  
  119.     ENDIF    ; ...already included